﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CoolCode 
{
    public class TextBuilder
    {
        protected StringBuilder Builder;

        public TextBuilder()
        {
            Builder = new StringBuilder();
        }

        public static TextBuilder operator +(TextBuilder self, string value)
        {
            self.Builder.Append(value);
            return self;
        }

        public static implicit operator TextBuilder(string value)
        {
            TextBuilder text = new TextBuilder();
            text.Builder.Append(value);
            return text;
        }

        //public static implicit operator TextBuilder(int value)
        //{
        //    TextBuilder text = new TextBuilder();
        //    text.Builder.Append(value);
        //    return text;
        //}

        //public static implicit operator TextBuilder(object value)
        //{
        //    TextBuilder text = new TextBuilder();
        //    text.Builder.Append(value);
        //    return text;
        //}

        public static implicit operator string(TextBuilder value)
        {
            return value.ToString();
        }

        public override string ToString()
        {
            return this.Builder.ToString();
        }
    }
}
